/*
注意：
    <1>加密狗检测间隔时间为30秒;
    <2>将授权状态将实时打印到/tmp/msauthentstatus文件;
*/
#define MSAUTHENTJNI_C
#include <stdlib.h> 
#include <stdio.h>
#include <string.h> 
#include <unistd.h>
#include "msdrm.h" 
#include "jni.h"

#define FLAG  "msdrmjni"
 JNIEXPORT void JNICALL Java_jniTest_msdrmjni_ptlinit( JNIEnv * env,jobject thiz,
 	jstring jurlin, jstring jurlout, jstring jkey, jint jlen) 
{
	ms_string urlin= (*env)->GetStringUTFChars(env, jurlin, ms_null);
	if(urlin == ms_null)  {
		return;  
	}  

	ms_string urlout= (*env)->GetStringUTFChars(env, jurlout, ms_null);
	if(urlout == ms_null)  {
		return;  
	}  
	ms_string key= (*env)->GetStringUTFChars(env, jkey, ms_null);
	if(key == ms_null)  {
		return;  
	}  
	msdrm_oneapi_ptlinit(urlin, urlout, key, jlen);

	(*env)->ReleaseStringUTFChars(env, jurlin, urlin);
	(*env)->ReleaseStringUTFChars(env, jurlout, urlout);
	(*env)->ReleaseStringUTFChars(env, jkey, key);
}

 JNIEXPORT void JNICALL Java_jniTest_msdrmjni_ptldeinit( JNIEnv * env,jobject thiz) 
 {
	msdrm_oneapi_ptldeinit();
}
#undef MSAUTHENTJNI_C

